We model a decision impact pathway is for school gardens as a general intervention for sustainable children’s food environments in urban Hanoi, Vietnam (Whitney et al. 2024).

Conceptual model of school gardens as an intervention. Should urban Hanoi school boards invest time and money in creating school gardens? Should they invest in formal STEM education as part of these gardens?

Urban Hanoi school garden

Simulation of the school garden intervention options:

# Source our model
source("Garden_Model.R")

# Ensure consistent results with the random number generator
# not for each 'run' of the MC simulation but for 
# consistency each time we run the entire simulation 
set.seed(42)

garden_simulation_results <- mcSimulation(
  estimate = estimate_read_csv("data/inputs_school_garden.csv"),
  model_function = school_garden_function,
  numberOfModelRuns = 1e4, #run 10,000 times
  functionSyntax = "plainNames"
)

The Net Present Value (i.e. current value of the future benefits) of the garden decision options over 5 years of the intervention. For public and private schools the STEM costs are considered to be in the same garden space but with the additional costs and benefits of a full STEM education program. All options are compared to the same years of using the land for something that is not related to the garden, i.e. as a playground or for parking. Here we plot the distribution for the decision and frame the projected NPV.

For public schools:

source("functions/plot_distributions.R")
plot_distributions(mcSimulation_object = garden_simulation_results, 
                                    vars = c("NPV_garden_public_school", 
                                             "NPV_garden_STEM_public_school"),
                   old_names = c("NPV_garden_public_school", "NPV_garden_STEM_public_school"),
                   new_names = c("NPV public school garden", "NPV public school garden with STEM"),
                                    method = 'smooth_simple_overlay', 
                                    base_size = 7, 
                                    x_axis_name = "Comparative NPV outcomes")

For private schools:

source("functions/plot_distributions.R")
plot_distributions(mcSimulation_object = garden_simulation_results, 
                                    vars = c("NPV_garden","NPV_garden_STEM"),
                   old_names = c("NPV_garden","NPV_garden_STEM"),
                   new_names = c("NPV private school garden","NPV private school with STEM"),
                                    method = 'smooth_simple_overlay', 
                                    base_size = 7, 
                                    x_axis_name = "Comparative NPV outcomes")

The same results again but this time as boxplots:

source("functions/plot_distributions.R")
plot_distributions(mcSimulation_object = garden_simulation_results, 
                   vars = c("NPV_garden","NPV_garden_STEM", "NPV_garden_public_school", "NPV_garden_STEM_public_school"),
                   old_names = c("NPV_garden","NPV_garden_STEM", "NPV_garden_public_school", "NPV_garden_STEM_public_school"),
                   new_names = c("NPV private school garden","NPV private school with STEM", "NPV public school garden", "NPV public school garden with STEM"),
                                    method = "boxplot", 
                                    base_size = 7, 
                                    x_axis_name = "Comparative NPV outcomes")

ggsave("figures/boxplots_all.png", width = 15, height = 8, units = "cm")

As boxplots and distributions for public schools:

source("functions/plot_distributions.R")
plot_distributions(mcSimulation_object = garden_simulation_results, 
                                    vars = c("NPV_garden_public_school", "NPV_garden_STEM_public_school"),
                   old_names = c("NPV_garden_public_school", "NPV_garden_STEM_public_school"),
                   new_names = c("NPV public school garden", "NPV public school garden with STEM"),
                                    method = "boxplot_density", 
                                    base_size = 7, 
                                    x_axis_name = "Comparative NPV outcomes")

As boxplots and distributions for private schools:

source("functions/plot_distributions.R")
plot_distributions(mcSimulation_object = garden_simulation_results, 
                                    vars = c("NPV_garden","NPV_garden_STEM"),
                   old_names = c("NPV_garden","NPV_garden_STEM"),
                   new_names = c("NPV private school garden","NPV private school with STEM"),
                                    method = "boxplot_density", 
                                    base_size = 7, 
                                    x_axis_name = "Comparative NPV outcomes")

Summary of results for the decision

Summary of the NPVs for the passive education garden and STEM options for private schools:

summary(garden_simulation_results$y[1:2]) #"NPV_garden"                    "NPV_garden_STEM"
##    NPV_garden      NPV_garden_STEM  
##  Min.   :-1420.0   Min.   :-4017.3  
##  1st Qu.: -171.5   1st Qu.: -488.5  
##  Median :  382.3   Median :  128.9  
##  Mean   :  692.8   Mean   :  346.2  
##  3rd Qu.: 1247.1   3rd Qu.:  982.8  
##  Max.   :10218.6   Max.   :10175.3

Summary of the NPVs for the passive education garden and STEM options for public schools:

summary(garden_simulation_results$y[3:4]) #"NPV_garden_public_school"      "NPV_garden_STEM_public_school"
##  NPV_garden_public_school NPV_garden_STEM_public_school
##  Min.   :-1420.0          Min.   :-4017.34             
##  1st Qu.: -285.7          1st Qu.: -460.28             
##  Median : -184.5          Median : -241.74             
##  Mean   :  288.3          Mean   :  -56.18             
##  3rd Qu.:  590.5          3rd Qu.:  121.57             
##  Max.   : 7138.2          Max.   : 6583.17

Summary of the child health outcomes for private and public schools:

summary(garden_simulation_results$y[6:7]) #"health" "health_STEM" 
##      health        health_STEM    
##  Min.   :   0.0   Min.   :   0.0  
##  1st Qu.: 304.8   1st Qu.: 278.1  
##  Median : 768.9   Median : 635.2  
##  Mean   : 836.7   Mean   : 651.8  
##  3rd Qu.:1227.3   3rd Qu.: 957.4  
##  Max.   :5452.9   Max.   :3775.8

Summary of the biodiversity outcomes for the passive education garden and STEM options for private and public schools:

summary(garden_simulation_results$y[5]) #"biodiversity"
##   biodiversity   
##  Min.   : 0.000  
##  1st Qu.: 4.278  
##  Median :11.194  
##  Mean   :11.300  
##  3rd Qu.:16.864  
##  Max.   :64.952

Summary of costs

Total expected costs for a school garden with and without STEM education:

summary(garden_simulation_results$y[8:9])
##   total_costs      total_costs_STEM
##  Min.   :  87.33   Min.   : 143.1  
##  1st Qu.: 199.98   1st Qu.: 357.2  
##  Median : 435.41   Median : 839.6  
##  Mean   : 398.83   Mean   : 929.8  
##  3rd Qu.: 514.87   3rd Qu.:1252.3  
##  Max.   :1474.13   Max.   :5011.9

First year expected costs for a school garden:

summary(garden_simulation_results$y$Cashflow_garden1)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -606.721  -95.383    8.306   65.859  174.797 1869.821

First year expected costs for a school garden with STEM education:

summary(garden_simulation_results$y$Cashflow_garden_STEM1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -943.72 -237.06 -121.76  -77.60   44.09 1772.05

Projection to Latent Structures (PLS)

We use Projection to Latent Structures (PLS) model to assess the correlation strength and direction for model variables and outcome variables. The Partial Least Squares is fitted with the orthogonal scores algorithm with pls::plsr.

PLS for private schools:

# For passive education garden option
source("functions/pls_model.R")
pls_result <- pls_model(object = garden_simulation_results,
                resultName = names(garden_simulation_results$y)[1], # the "NPV_garden" 
                                ncomp = 1)
# read in the common input table
input_table <- read.csv("data/inputs_school_garden.csv")

label_private_school <- "Private school"

# source the plot function
source("functions/plot_pls.R")

plot_pls_garden <- plot_pls(plsrResults = pls_result, 
                            input_table = input_table, 
                            threshold = 0.9) + 
  theme(legend.position = "none", axis.title.x = element_blank(), 
  axis.text.x = element_blank(),
  axis.ticks = element_blank()) + scale_x_continuous(limits = c(0, 7)) + ggtitle(label_private_school) + 
  annotate(geom="text", x=5, y=1, label="Garden")
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
#For school garden with formal STEM education
pls_result_STEM <- pls_model(object = garden_simulation_results,
                  resultName = names(garden_simulation_results$y)[2], # the "NPV_garden_STEM" 
                                ncomp = 1)

plot_pls_STEM <- plot_pls(plsrResults = pls_result_STEM, 
                          input_table = input_table, 
                          threshold = 0.9) + 
  scale_x_continuous(limits = c(0, 7)) + 
  annotate(geom="text", x=5, y=1, label="STEM garden")
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
plot_pls_garden / plot_pls_STEM 

Interpretation of PLS results for private schools

Garden options for private schools:

source("functions/pls_posthoc.R")
pls_posthoc(plsrResults = pls_result, threshold = 0.9)
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   79.536
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   79.536
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   79.536
## PLS Model Summary:
## Number of Components: 1 
## R-squared Value for Y: 
## % Variance Explained in X: 
## % Variance Explained in Y: 
## 
## Important Variables (VIP > 0.9):
##                              Variable      VIP Coefficient
## if_community_likes if_community_likes 3.966649    476.7332
## school_event_value school_event_value 6.784288    815.3724
## school_event_freq   school_event_freq 3.350710    402.7064
## $plsrResults
## Partial least squares regression, fitted with the orthogonal scores algorithm.
## Call:
## plsr(formula = y ~ x, ncomp = ncomp, method = "oscorespls", scale = scale)
## 
## $r_squared
## NULL
## 
## $explained_variance_x
## NULL
## 
## $explained_variance_y
## NULL
## 
## $important_vars
##                              Variable      VIP Coefficient
## if_community_likes if_community_likes 3.966649    476.7332
## school_event_value school_event_value 6.784288    815.3724
## school_event_freq   school_event_freq 3.350710    402.7064

STEM options for private schools:

pls_posthoc(plsrResults = pls_result_STEM, threshold = 0.9)
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.381
## y   74.287
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.381
## y   74.287
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.381
## y   74.287
## PLS Model Summary:
## Number of Components: 1 
## R-squared Value for Y: 
## % Variance Explained in X: 
## % Variance Explained in Y: 
## 
## Important Variables (VIP > 0.9):
##                                        Variable      VIP Coefficient
## if_community_likes           if_community_likes 3.789712    484.8643
## annual_teacher_training annual_teacher_training 2.809487   -359.4521
## school_event_value           school_event_value 6.350470    812.4936
## school_event_freq             school_event_freq 3.123342    399.6074
## $plsrResults
## Partial least squares regression, fitted with the orthogonal scores algorithm.
## Call:
## plsr(formula = y ~ x, ncomp = ncomp, method = "oscorespls", scale = scale)
## 
## $r_squared
## NULL
## 
## $explained_variance_x
## NULL
## 
## $explained_variance_y
## NULL
## 
## $important_vars
##                                        Variable      VIP Coefficient
## if_community_likes           if_community_likes 3.789712    484.8643
## annual_teacher_training annual_teacher_training 2.809487   -359.4521
## school_event_value           school_event_value 6.350470    812.4936
## school_event_freq             school_event_freq 3.123342    399.6074

PLS for public schools:

# For passive education garden option
source("functions/pls_model.R")

pls_result_garden_public <- pls_model(object = garden_simulation_results,
                resultName = names(garden_simulation_results$y)[3], 
                # "NPV_garden_public_school" 
                                ncomp = 1)
# read in the common input table
input_table <- read.csv("data/inputs_school_garden.csv")

label_public_school <- "Public school"

# source the plot function
source("functions/plot_pls.R")
plot_pls_garden_public <- plot_pls(pls_result_garden_public, 
                            input_table = input_table, threshold = 0.9) +
  theme(legend.position = "none", axis.title.x = element_blank(), 
  axis.text.x = element_blank(),
  axis.ticks = element_blank()) + 
  scale_x_continuous(limits = c(0, 7)) + ggtitle(label_public_school) + 
  annotate(geom="text", x=5, y=1, label="Garden")
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
#For school garden with formal STEM education
pls_result_STEM_public <- pls_model(object = garden_simulation_results,
                  resultName = names(garden_simulation_results$y)[4], 
                  # "NPV_garden_STEM_public_school"
                                ncomp = 1)

plot_pls_public_STEM <- plot_pls(pls_result_STEM_public, 
                                 input_table = input_table, threshold = 0.9) + scale_x_continuous(limits = c(0, 7)) + 
  annotate(geom="text", x=5, y=1, label="STEM garden")
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
plot_pls_garden_public / plot_pls_public_STEM 

Interpretation of PLS results for public schools

Garden option in public school:

source("functions/pls_posthoc.R")
pls_posthoc(plsrResults = pls_result_garden_public, threshold = 0.9)
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.379
## y   45.493
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.379
## y   45.493
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.379
## y   45.493
## PLS Model Summary:
## Number of Components: 1 
## R-squared Value for Y: 
## % Variance Explained in X: 
## % Variance Explained in Y: 
## 
## Important Variables (VIP > 0.9):
##                                                      Variable       VIP
## if_community_likes                         if_community_likes 3.7987712
## school_event_value                         school_event_value 6.6610439
## school_event_freq                           school_event_freq 3.2684011
## suitability_of_land_for_garden suitability_of_land_for_garden 0.9145923
## beurocratic_barriers                     beurocratic_barriers 1.3202388
##                                Coefficient
## if_community_likes               297.94033
## school_event_value               522.43043
## school_event_freq                256.34303
## suitability_of_land_for_garden    71.73213
## beurocratic_barriers            -103.54727
## $plsrResults
## Partial least squares regression, fitted with the orthogonal scores algorithm.
## Call:
## plsr(formula = y ~ x, ncomp = ncomp, method = "oscorespls", scale = scale)
## 
## $r_squared
## NULL
## 
## $explained_variance_x
## NULL
## 
## $explained_variance_y
## NULL
## 
## $important_vars
##                                                      Variable       VIP
## if_community_likes                         if_community_likes 3.7987712
## school_event_value                         school_event_value 6.6610439
## school_event_freq                           school_event_freq 3.2684011
## suitability_of_land_for_garden suitability_of_land_for_garden 0.9145923
## beurocratic_barriers                     beurocratic_barriers 1.3202388
##                                Coefficient
## if_community_likes               297.94033
## school_event_value               522.43043
## school_event_freq                256.34303
## suitability_of_land_for_garden    71.73213
## beurocratic_barriers            -103.54727

STEM option in public school:

pls_posthoc(plsrResults = pls_result_STEM_public, threshold = 0.9)
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   52.799
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   52.799
## Data:    X dimension: 10000 75 
##  Y dimension: 10000 1
## Fit method: oscorespls
## Number of components considered: 1
## TRAINING: % variance explained
##    1 comps
## X    1.378
## y   52.799
## PLS Model Summary:
## Number of Components: 1 
## R-squared Value for Y: 
## % Variance Explained in X: 
## % Variance Explained in Y: 
## 
## Important Variables (VIP > 0.9):
##                                        Variable      VIP Coefficient
## if_community_likes           if_community_likes 3.596175    306.5634
## annual_teacher_training annual_teacher_training 3.599088   -306.8117
## school_event_value           school_event_value 6.115816    521.3553
## school_event_freq             school_event_freq 2.975338    253.6388
## $plsrResults
## Partial least squares regression, fitted with the orthogonal scores algorithm.
## Call:
## plsr(formula = y ~ x, ncomp = ncomp, method = "oscorespls", scale = scale)
## 
## $r_squared
## NULL
## 
## $explained_variance_x
## NULL
## 
## $explained_variance_y
## NULL
## 
## $important_vars
##                                        Variable      VIP Coefficient
## if_community_likes           if_community_likes 3.596175    306.5634
## annual_teacher_training annual_teacher_training 3.599088   -306.8117
## school_event_value           school_event_value 6.115816    521.3553
## school_event_freq             school_event_freq 2.975338    253.6388

Value of Information

Here we assess value of information with the multi_EVPI function. We calculate value of information in the form of Expected Value of Perfect Information (EVPI).

# Subset the outputs from the mcSimulation function (y) by selecting the correct variables be sure to run the multi_EVPI only on the variables that we want. Find them with names(garden_simulation_results$y)
mcSimulation_table <- data.frame(garden_simulation_results$x, 
                                 garden_simulation_results$y[1:9])

# List of NPV variables to move to the last position (calculate 4 EVPIs only)
npvs_to_move <- c("NPV_garden", "NPV_garden_STEM", 
                  "NPV_garden_public_school", "NPV_garden_STEM_public_school")

# Move NPV variables to the last position
mcSimulation_table <- mcSimulation_table %>% select(-all_of(npvs_to_move), all_of(npvs_to_move))

Calculate EVPI:

source("functions/multi_EVPI_test.R")
# evpi <- multi_EVPI_test(mc = mcSimulation_table, first_out_var = "NPV_garden")
# save as a local .csv (takes ~ 15 minutes to run this)
# save(evpi,file="data/data_evpi.Rda")
 load("data/data_evpi.Rda")
# open from saved file (last model run) - it is stable result / takes very long to run 

EVPI for private schools:

#Value of information the garden intervention decision
  source("functions/plot_evpi.R")
plot_evpi_garden <- plot_evpi(EVPIresults = evpi, 
                              decision_vars = "NPV_garden", 
                              new_names = "Garden",
                            input_table = input_table, 
                            threshold = 10) +
  theme(legend.position = "none", axis.title.x = element_blank(), 
  axis.text.x = element_blank(),
  axis.ticks = element_blank()) + 
  scale_x_continuous(limits = c(0, 210)) + ggtitle(label_private_school) 
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
# Value of information for the garden option with formal STEM education.
# using the results of the same multi_EVPI
plot_evpi_STEM <- plot_evpi(EVPIresults = evpi, 
                            decision_vars = "NPV_garden_STEM", 
                            new_names = "STEM garden",
                            input_table = input_table, 
                            threshold = 10)+ scale_x_continuous(limits = c(0, 210)) 
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
 plot_evpi_garden / plot_evpi_STEM

EVPI for public schools:

# Value of information for the public school garden option with no formal STEM education.

# using the results of the same multi_EVPI
plot_evpi_public <- plot_evpi(evpi, decision_vars = "NPV_garden_public_school", 
                            new_names = "Garden", 
                            input_table = input_table, 
                            threshold = 10) +
  theme(legend.position = "none", axis.title.x = element_blank(), 
  axis.text.x = element_blank(),
  axis.ticks = element_blank()) + 
  scale_x_continuous(limits = c(0, 210)) + ggtitle(label_public_school) #210
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
# Value of information for the public school garden option with formal STEM education.
# using the results of the same multi_EVPI
plot_evpi_public_STEM <- plot_evpi(evpi, decision_vars = "NPV_garden_STEM_public_school", 
                            new_names = "STEM garden",
                            input_table = input_table, 
                            threshold = 10) + 
  scale_x_continuous(limits = c(0, 210))  #210
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
plot_evpi_public / plot_evpi_public_STEM
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_col()`).

Cash flows

Cash flow plots of the garden option without formal STEM education. These are the expected costs for public and private schools over the intervention.

# Cashflow of the garden option without formal STEM education
# This will be the cost for public and private schools over the intervention. 

source("functions/plot_cashflow.R")
plot_cashflow_garden <- plot_cashflow(mcSimulation_object = garden_simulation_results, 
              cashflow_var_name = "Cashflow_garden", 
              facet_labels = "Garden") + 
  theme(legend.position = "none", axis.title.x = element_blank(), 
  axis.text.x = element_blank(),
  axis.ticks = element_blank())  

# Cashflow of the garden option with formal STEM education
source("functions/plot_cashflow.R")
plot_cashflow_STEM <- plot_cashflow(mcSimulation_object = garden_simulation_results, 
              cashflow_var_name = "Cashflow_garden_STEM", 
              facet_labels = "STEM Garden")

plot_cashflow_garden / plot_cashflow_STEM 

ggsave("figures/Fig_9_cashflow.png", width=5, height=5) 

Pareto-optimal solutions

These figures display the Pareto-optimal solutions, representing the best trade-offs among the objectives of biodiversity, child health, and economic return. By focusing on these Pareto-optimal points, the analysis highlights solutions where improvements in one objective cannot be achieved without some compromise in at least one other.

Private schools Pareto-optimal solutions:

source("functions/plot_pareto.R")
private_pareto <- plot_pareto(
  economic_return_garden = garden_simulation_results$y$NPV_garden,
  health_garden = garden_simulation_results$y$health,
  biodiversity_garden = garden_simulation_results$y$biodiversity,
  economic_return_STEM = garden_simulation_results$y$NPV_garden_STEM,
  health_STEM = garden_simulation_results$y$health_STEM,
  biodiversity_STEM = garden_simulation_results$y$biodiversity, 
  plot_return = "scatter" 
)

ggplotly(private_pareto) 
knitr::include_graphics("figures/private_pareto_scatter.png")

knitr::include_graphics("figures/private_pareto_surface.png")

Private school Pareto-optimal solutions interpretation:

source("functions/pareto_posthoc.R")
private_pareto_posthoc <- pareto_posthoc(
  economic_return_garden = garden_simulation_results$y$NPV_garden,
  health_garden = garden_simulation_results$y$health,
  biodiversity_garden = garden_simulation_results$y$biodiversity,
  economic_return_STEM = garden_simulation_results$y$NPV_garden_STEM,
  health_STEM = garden_simulation_results$y$health_STEM,
  biodiversity_STEM = garden_simulation_results$y$biodiversity 
)
## Number of Pareto-optimal points for STEM option: 47 
## Number of Pareto-optimal points for Garden option: 66 
## 
## Summary of Pareto-optimal points for STEM option:
##  economic_return    biodiversity        health      
##  Min.   : -576.6   Min.   : 718.5   Min.   : 7.671  
##  1st Qu.:  884.9   1st Qu.:1437.3   1st Qu.:24.519  
##  Median : 2178.2   Median :1867.4   Median :31.754  
##  Mean   : 2883.6   Mean   :2212.3   Mean   :31.578  
##  3rd Qu.: 4239.7   3rd Qu.:3000.3   3rd Qu.:38.132  
##  Max.   :10218.6   Max.   :5452.9   Max.   :64.952  
## 
## Summary of Pareto-optimal points for Garden option:
##  economic_return    biodiversity        health      
##  Min.   :-2564.8   Min.   : 402.6   Min.   : 7.671  
##  1st Qu.:  983.1   1st Qu.:1112.0   1st Qu.:18.787  
##  Median : 2264.2   Median :1533.7   Median :26.716  
##  Mean   : 2536.1   Mean   :1623.1   Mean   :28.389  
##  3rd Qu.: 4089.9   3rd Qu.:2086.7   3rd Qu.:36.457  
##  Max.   :10175.3   Max.   :3775.8   Max.   :64.952
private_pareto_posthoc
## $num_pareto_stem
## [1] 47
## 
## $num_pareto_garden
## [1] 66
## 
## $stem_summary
##  economic_return    biodiversity        health      
##  Min.   : -576.6   Min.   : 718.5   Min.   : 7.671  
##  1st Qu.:  884.9   1st Qu.:1437.3   1st Qu.:24.519  
##  Median : 2178.2   Median :1867.4   Median :31.754  
##  Mean   : 2883.6   Mean   :2212.3   Mean   :31.578  
##  3rd Qu.: 4239.7   3rd Qu.:3000.3   3rd Qu.:38.132  
##  Max.   :10218.6   Max.   :5452.9   Max.   :64.952  
## 
## $garden_summary
##  economic_return    biodiversity        health      
##  Min.   :-2564.8   Min.   : 402.6   Min.   : 7.671  
##  1st Qu.:  983.1   1st Qu.:1112.0   1st Qu.:18.787  
##  Median : 2264.2   Median :1533.7   Median :26.716  
##  Mean   : 2536.1   Mean   :1623.1   Mean   :28.389  
##  3rd Qu.: 4089.9   3rd Qu.:2086.7   3rd Qu.:36.457  
##  Max.   :10175.3   Max.   :3775.8   Max.   :64.952

Public schools Pareto-optimal solutions:

source("functions/plot_pareto.R")
public_pareto <- plot_pareto(
  economic_return_garden = garden_simulation_results$y$NPV_garden_public_school,
  health_garden = garden_simulation_results$y$health,
  biodiversity_garden = garden_simulation_results$y$biodiversity,
  economic_return_STEM = garden_simulation_results$y$NPV_garden_STEM_public_school,
  health_STEM = garden_simulation_results$y$health_STEM,
  biodiversity_STEM = garden_simulation_results$y$biodiversity, 
   plot_return = "scatter" 
)

ggplotly(public_pareto) 

knitr::include_graphics("figures/public_pareto_scatter.png")

knitr::include_graphics("figures/public_pareto_surface.png")

Public school Pareto-optimal solutions interpretation:

source("functions/pareto_posthoc.R")
public_pareto_posthoc <- pareto_posthoc(
  economic_return_garden = garden_simulation_results$y$NPV_garden_public_school,
  health_garden = garden_simulation_results$y$health,
  biodiversity_garden = garden_simulation_results$y$biodiversity,
  economic_return_STEM = garden_simulation_results$y$NPV_garden_STEM_public_school,
  health_STEM = garden_simulation_results$y$health_STEM,
  biodiversity_STEM = garden_simulation_results$y$biodiversity
)
## Number of Pareto-optimal points for STEM option: 56 
## Number of Pareto-optimal points for Garden option: 71 
## 
## Summary of Pareto-optimal points for STEM option:
##  economic_return   biodiversity      health     
##  Min.   :-576.6   Min.   :   0   Min.   : 0.00  
##  1st Qu.:1222.1   1st Qu.:1092   1st Qu.:21.40  
##  Median :2839.3   Median :1469   Median :27.83  
##  Mean   :2978.7   Mean   :1823   Mean   :28.17  
##  3rd Qu.:5080.4   3rd Qu.:2199   3rd Qu.:35.67  
##  Max.   :7138.2   Max.   :5453   Max.   :64.95  
## 
## Summary of Pareto-optimal points for Garden option:
##  economic_return     biodiversity        health      
##  Min.   :-2564.85   Min.   : 151.4   Min.   : 7.671  
##  1st Qu.:   66.99   1st Qu.:1003.4   1st Qu.:19.026  
##  Median : 2078.60   Median :1404.3   Median :24.732  
##  Mean   : 2151.91   Mean   :1576.8   Mean   :27.016  
##  3rd Qu.: 3952.36   3rd Qu.:2064.8   3rd Qu.:35.411  
##  Max.   : 6583.17   Max.   :3775.8   Max.   :64.952
public_pareto_posthoc
## $num_pareto_stem
## [1] 56
## 
## $num_pareto_garden
## [1] 71
## 
## $stem_summary
##  economic_return   biodiversity      health     
##  Min.   :-576.6   Min.   :   0   Min.   : 0.00  
##  1st Qu.:1222.1   1st Qu.:1092   1st Qu.:21.40  
##  Median :2839.3   Median :1469   Median :27.83  
##  Mean   :2978.7   Mean   :1823   Mean   :28.17  
##  3rd Qu.:5080.4   3rd Qu.:2199   3rd Qu.:35.67  
##  Max.   :7138.2   Max.   :5453   Max.   :64.95  
## 
## $garden_summary
##  economic_return     biodiversity        health      
##  Min.   :-2564.85   Min.   : 151.4   Min.   : 7.671  
##  1st Qu.:   66.99   1st Qu.:1003.4   1st Qu.:19.026  
##  Median : 2078.60   Median :1404.3   Median :24.732  
##  Mean   : 2151.91   Mean   :1576.8   Mean   :27.016  
##  3rd Qu.: 3952.36   3rd Qu.:2064.8   3rd Qu.:35.411  
##  Max.   : 6583.17   Max.   :3775.8   Max.   :64.952

Input data for the simulations

Summary

Here we provide a summary of the garden intervention options. We do this with a summary table of the simulation results. We show the percentage of missing values as well as the mean, median and standard deviation (SD) for each output of our model simulations. We use the gt_plt_summary() from {gtExtras} and with options from {svglite}. The table shows the name, the plot overview as well as the number of missing values, the mean, median and the standard deviation of the distribution for all variables that were fed into the model from our input table of uncertainty values.

# Subset the outputs from the mcSimulation function (y) to summarize only on the variables that we want.
# names(garden_simulation_results$x)
mcSimulation_table_x <- data.frame(garden_simulation_results$x[4:7]) #, 21:30, 32:41, 43:70, 73:76)  also of possible interest

 gtExtras::gt_plt_summary(mcSimulation_table_x) 
mcSimulation_table_x
10000 rows x 4 cols
Column Plot Overview Missing Mean Median SD
inflation_rate 214 0.0% 7.5 7.5 1.5
size_of_garden 0183 0.0% 45.7 41.8 29.6
expensive_garden_size 70103 0.0% 87.4 87.5 4.5
cost_increase_expensive_garden_size 0.13.4 0.0% 1.8 1.8 0.4
# a summary table with missing, mean, median and sd

The table shows the variable name, the plot overview as well as the number of missing values, the mean, median and the standard deviation of the distribution for variables that calculated in the model.

The full repository can be accessed at https://github.com/CWWhitney/urban_school_gardens